package com.garden.web.controller.support;

import java.util.HashMap;
import java.util.Map;

public class ResponseWrapper {
    private String message = "";
    private int code = 0;
    private boolean success = true;
    private Object data = new HashMap<String, Object>();

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public void add(String key, Object value) {
        ((Map<String, Object>)data).put(key, value);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "{code:" + code + "" +
                "message:" + message + "" +
                "success:" + success + "" +
                "data:" + data.toString() +"}";
    }
}
